<?php
/* @var $this BackendController */
/* @var $model Article */

$this->breadcrumbs=array(
    Yii::t('ArticleModule.base','Articles')=>array('index'),
    Yii::t('ArticleModule.base','Manage'),
);
$this->menu=array(
    array('label'=>'<span class="glyphicon glyphicon-plus"></span>&nbsp'.Yii::t('ArticleModule.base','Create Article'), 'url'=>array('create')),
    array('label'=>'<span class="glyphicon glyphicon-cog"></span>&nbsp'.Yii::t('ArticleModule.base','List Article'), 'url'=>array('index')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#article-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h3><?php echo Yii::t('ArticleModule.base','Manage Article')?></h3>

<p>
    <?php echo Yii::t('ArticleModule.base','You may optionally enter a comparison operator')?> (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
    <?php echo Yii::t('ArticleModule.base','or')?> <b>=</b>) <?php echo Yii::t('ArticleModule.base','at the beginning of each of your search values to specify how the comparison should be done.')?>
</p>

<?php echo CHtml::link(Yii::t('ArticleModule.base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'article-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
    'pager' => array('cssFile' => Yii::app()->theme->baseUrl . '/assets/gridview/pager.css'),
    'baseScriptUrl'=>Yii::app()->theme->baseUrl.'/assets/gridview',
    //'ajaxType'=>'POST',
    //'ajaxUpdate'=>'true',

    'columns'=>array(

        array(
            'name'=>'id',
            'type' => 'raw',
            'htmlOptions' => array('style'=>'width:10px'),
        ),
        array(
            'name' => 'image',
            'type' => 'raw',
            'value' => '$data->getImageForGrid()',
            'htmlOptions' => array('style'=>'height:80px;width:100px'),
        ),
        array(
            'name'=>'title',
            'type' => 'raw',
            'htmlOptions' => array('style'=>'width:30px'),
        ),
        array(
            'name'=>'create_time',
            'type'=>'raw',
            'value'=>'$data->getCreateDateTimeFormat()',
            'htmlOptions' => array('style'=>'width:100px'),
        ),
        array(
            'name'=>'update_time',
            'type'=>'raw',
            'value'=>'$data->getUpdateDateTimeFormat()',
            'htmlOptions' => array('style'=>'width:100px'),
        ),
        array(
            'name'=>'status',
            'type' => 'raw',
            'value'=>'$data->getArticleStatus()',
            'htmlOptions' => array('style'=>'width:30px'),

        ),

        array(
            'class'=>'CButtonColumn',
            'htmlOptions' => array('style'=>'width:50px'),
            'template'=>'{view}  {update}  {delete}',
          //  'viewButtonOptions'=>array('class'=>'glyphicon glyphicon-eye-open','style'=>'padding-right:5px'),
          //  'updateButtonOptions'=>array('class'=>'glyphicon glyphicon-edit','style'=>'padding-right:5px'),
          //  'deleteButtonOptions'=>array('class'=>'glyphicon glyphicon-trash','style'=>'padding-right:5px'),
            'buttons'=>array(
                'view'=>array(
                    'label'=>'',
                    'imageUrl'=>'',
                    'options'=>array('class'=>'glyphicon glyphicon-eye-open','style'=>'padding-right:5px'),
                ),
                'update'=>array(
                    'label'=>'',
                    'imageUrl'=>'',
                    'options'=>array('class'=>'glyphicon glyphicon-edit','style'=>'padding-right:5px'),
                ),
                'delete'=>array(
                    'label'=>'',
                    'imageUrl'=>'',
                    'options'=>array('class'=>'glyphicon glyphicon-trash','style'=>'padding-right:5px'),
                ),
            )
        ),
	),
)); ?>